package com.zyit.controller;

import com.zyit.service.PrescriptiomService;
import com.zyit.util.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/prescriptiom")
public class PrescriptiomController {
      @Resource
    private PrescriptiomService prescriptiomService;

    /**
     * 根据病人id 和 病单ID 修改处方支付状态
     * @param registryId
     * @param patientId
     * @return
     */
          @PostMapping("/pay")
          public Result updatePay(@RequestParam Integer registryId, @RequestParam Integer patientId) {
              int i = prescriptiomService.updatePayStatus(registryId, patientId);
              return new Result(200, i, "Update successful");
          }

    /**
     * 根据病人id 和 病单ID 修改取药状态
     * @param registryId
     * @param patientId
     * @return
     */
    @PostMapping("/isFetchMedicine")
    public Result updateIsFetchMedicine(@RequestParam Integer registryId, @RequestParam Integer patientId) {
        System.out.println(registryId);
        System.out.println(patientId);
        int i = prescriptiomService.updateIsFetchMedicine(registryId, patientId);
        return new Result(200, i, "取药成功");
    }
}
